<template>
  <div class="main">
<!--    oc首页左侧-->
    <div style="width: 49%">
      <oc-index-left></oc-index-left>
    </div>
<!--    oc首页右侧-->
    <div style="width: 49%">
      <oc-index-right></oc-index-right>
    </div>
  </div>
</template>
<script>
import { createEventHandler } from "@/util/events";
import {
  commitAndOnline,
  submitted,
  typeAndNumber,
  typeAndNumberAudit,
  numberAndRate,
  online
} from '@/api/creativeReport/basicsReport';
import store from "@/store/"
import Moment from "moment"
import ocIndexLeft from "./ocIndexLeft";
import ocIndexRight from "./ocIndexRight";

export default {
  name: 'basicsReport',
  components:{ocIndexRight,ocIndexLeft},
  data() {
    return {

    }
  },
  beforeDestroy() {
    let self = this;
    if(self.eventHandler) {
      self.eventHandler.clear();
    }
  },
  created() {
    this.offerId = store.state.user.offer
    this.refresh = ()=>{
      //refresh开始，这样写避免代码迁移太多
      submitted(this.offerId).then(res => {
        this.submittedList = [{id:'',realName:'全部'},...res.data.data]
      })
    };

    let self = this;
    this.eventHandler = createEventHandler("offerCenter")
      .addListener((event) => {
        if(event.message == 'offerChanged' && event.offerId && event.offerId !== "" ) {
          this.offerId = event.offerId
          self.refresh();
        }
      });
    this.refresh();
  },
  methods: {

  }
}
</script>
<style lang="scss">
.main{
  display: flex;
  justify-content:space-around;
  margin-bottom: 20px;
}

</style>
